package com.pxx.item.api;

import com.item.common.PageResult;
import com.pxx.item.pojo.Sku;
import com.pxx.item.pojo.TbSpuDetail;
import com.pxx.item.pojo.vo.SpuVo;
import org.springframework.http.ResponseEntity;
import org.springframework.util.CollectionUtils;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

public interface GoodsApi {
    /**
     * 分页查询商品
     * @param key
     * @param saleable
     * @param page
     * @param rows
     * @return
     */
    @GetMapping("/spu/page")
     PageResult<SpuVo> querySpuVoPage(
            @RequestParam(value = "key",required = false) String key,
            @RequestParam(value = "saleable",required = false)   Boolean saleable,
            @RequestParam(value = "page",defaultValue = "1")    Integer page,
            @RequestParam(value = "rows",defaultValue = "5")     Integer rows
    );

    /**
     * 根据spuId查询spuDetail的详情
     * @param spuId
     * @return
     */
    @GetMapping("/spu/detail/{spuId}")
     TbSpuDetail querySpuDetailBySpuId(@PathVariable("spuId")Long spuId);


    /**
     * 通过spuId查询skus的列表数据
     */
     @GetMapping("/sku/list")
     List<Sku> querySkuListBySpuId(@RequestParam("id")Long id);


}
